package com.dao;

import com.entity.Grade;
import com.entity.Student;
import com.mysql.cj.BindValue;

import java.util.List;

/**
 * @author wzm
 * @create 2023-06-16 10:41
 */
public class BaseDaoTest {
    public static void main(String[] args) {
    BaseDao baseDao = new BaseDao();
    //测试新增
    //String sql = "insert into student values(?,?,?,?,?,?,?)";
//    String sql = "delete from student where id = ?";
//    int update = baseDao.update(sql, 8);
//    System.out.println(update);
       /* Grade grade = baseDao.selectByOne(Grade.class, "select * from grade where grade_id = ?", 1);
        System.out.println("grade = " + grade);


        Student student = baseDao.selectByOne(Student.class, "select * from student where id = ?", 1);
        System.out.println("student = " + student);*/
        
        
        /*String sql = "select * from student";
        List<Student> list = baseDao.selectForList(Student.class, sql);
        System.out.println("list = " + list);

        String sql1 = "select * from grade";
        List<Grade> grades = baseDao.selectForList(Grade.class, sql1);
        System.out.println("grades = " + grades);*/
        
        String sql = "select avg(age) from student";
        Object o = baseDao.selectForValue(sql);
        System.out.println("o = " + o);
    }
}
